#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll M = 1000LL * 1000* 1000 + 7;

inline void solve(int n, ll d, int x, vector<ll>& res){
	if (d == 1) {
		fill(res.begin(), res.begin() + min(n, x) + 1, 1LL);
		fill(res.begin() + min(n, x) + 1, res.end(), 0LL);
		return;
	}
	vector<ll> t(2001);
	solve(n, d / 2, x, t);
	for (int i = 0; i <= n; ++i)
		for (int j = 0; j + i <= n; ++j){
			res[i + j] += t[i] * t[j] % M;
			res[i + j] %= M;
		}
	if (d & 1){
		swap(res, t);
		fill(res.begin(), res.end(), 0);
		for (int i = 0; i <= n; ++i)
			for (int j = 0; j + i <= n && j <= min(n, x); ++j){
				res[i + j] += t[i];
				res[i + j] %= M;
			}
	}

}

int main(){
	ios_base::sync_with_stdio(false);
	int n, x;
	ll d;
	vector<ll> a(2001);
	while (true){
		fill(a.begin(), a.end(), 0LL);
		//fill(b.begin(), b.end(), 0LL);
		cin >> n >> d >> x;
		--x;
		if (n == 0) break;
		solve(n, d, x, a);
		cout << a[n] << endl;
	}
	return 0;
}